//
//  MFAConfigOptions.m
//  NewMissFresh
//
//  Created by 董宝君 on 2019/6/10.
//  Copyright © 2019 com.missfresh. All rights reserved.
//

#import "MFAConfigOptions.h"

@interface MFAConfigOptions ()
@property (nonatomic, copy, readwrite) NSString *serverURL;
@end

@implementation MFAConfigOptions

- (instancetype)initWithServerURL:(NSString *)serverURL {
    if(self = [super init]){
        _serverURL = serverURL;
        
        _flushInterval = 15 * 1000;
        _flushBulkSize = 100;
        _transLimit = 50;
        _maxCacheSize = 10000;
        
        _disableSDK = NO;
        _encrypted = NO;
    }
    return self;
}

#pragma mark - set

- (void)setFlushInterval:(NSInteger)flushInterval {
    _flushInterval = flushInterval >= 5000 ? flushInterval : 5000;
}

- (void)setFlushBulkSize:(NSInteger)flushBulkSize {
    _flushBulkSize = flushBulkSize >= 50 ? flushBulkSize : 50;
}

- (void)setTransLimit:(NSInteger)transLimit {
    if(transLimit > 0){
        _transLimit = transLimit <= 50 ? transLimit : 50;
    }
}

- (void)setMaxCacheSize:(NSInteger)maxCacheSize {
    _maxCacheSize = maxCacheSize >= 10000 ? maxCacheSize : 10000;
}

@end
